#----------------------------------------------------
# VisualK-OS                                         
#    Module: SynthStation Config Screen class [v1.0] 
#    Author: Kevin Slaughter                         
#----------------------------------------------------

"""
[Revision History]
    v1.0: Initial implementation... Having the screens encapsulated by
            the ScreenManager class with if-then-else blocks worked at
            first, when not much as required of the program, but more
            complex classes arose out of necessity to shrink/simplify
            the growing source code.
"""

import globals, curses
from VKCC_Constants import *


class cScreenCfgSS(object):
    ### General properties
    color = 2                               # Color theme used within this screen
    title = "Configuration (Synth-Station)" # Title to be displayed
    hasExit = True                          # Flag: Display exit option
    
    
    ### handleKey(): Handle any passed keyboard input independent of GP usage.
    def handleKey(self, c, scr):
        if (c == curses.KEY_LEFT):      # Left arrow
            if (globals.SynthStation.curProg>0):
                globals.SynthStation.curProg = (globals.SynthStation.curProg-1)
                scr.printText(18,4," "+str(globals.SynthStation.curProg)+"  ",T_HEADER)
                scr.redraw = True

        elif (c == curses.KEY_RIGHT):   # Right arrow
            if (globals.SynthStation.curProg<256):
                globals.SynthStation.curProg = (globals.SynthStation.curProg+1)
                scr.printText(18,4," "+str(globals.SynthStation.curProg)+"  ",T_HEADER)
                scr.redraw = True
        if (c == KEY_0): scr.changeScreen(SCREEN_CFG_MAIN) 	# 0 = Back to main cfg menu
        return
    
    
    ### paint(): Draw any elements used on this screen.
    def paint(self, scr):
        scr.menuPrep(self)
        scr.printText(2,4, "Active Program:  "+str(globals.SynthStation.curProg)+"    (< or >)", T_HEADER)
        return
    